package com.zms.ascii;

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.IOException;

public class AsciiToNative {
    public static void main(String[] args) throws Exception {
        String from=args[0];
        /*String to;
        if(args.length>1) {
            to=args[1];
        } else {
            to=from;
        }*/
        InputStream input=new FileInputStream(from);
        ByteArrayOutputStream output=new ByteArrayOutputStream() {
            public synchronized void write(int b) {
                System.out.write(b);
                super.write(b);
            }

            public void write(byte b[]) throws IOException {
                System.out.write(b);
                super.write(b);
            }
        };
        int c=input.read();
        while(c!=-1) {
            if(c=='\\') {
                int c1=input.read();
                if(c1==-1) {
                    output.write(c);
                    break;
                } else if(c1=='u' || c1=='U') {
                    int[] cc=new int[4];
                    for(int i=0;i<4;i++) {
                        cc[i]=input.read();
                    }
                    boolean ok=true;
                    for(int i=0;i<4;i++) {
                        if(cc[i]==-1 || !((cc[i]>='0' && cc[i]<='9') || (cc[i]>='a' && cc[i]<='f') || (cc[i]>='A' && cc[i]<='F'))) {
                            ok=false;
                            break;
                        }
                    }
                    if(ok) {
                        c=Integer.parseInt(new String(cc,0,4),16);
                        String s=""+(char)c;
                        output.write(s.getBytes());
                    } else {
                        output.write(c);
                        output.write(c1);
                        for(int i=0;i<4;i++) {
                            if(cc[i]==-1) {
                                break;
                            } else {
                                output.write(cc[i]);
                            }
                        }
                    }
                } else {
                    output.write(c);
                    output.write(c1);
                }
            } else {
                output.write(c);
            }
            c=input.read();
        }
    }
}
